package com.qk.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.qk.common.PageResult;
import com.qk.entity.OperateLog;
import com.qk.mapper.OperateLogMapper;
import com.qk.service.OperateLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class OperateLogServiceImpl extends ServiceImpl<OperateLogMapper, OperateLog> implements OperateLogService {
    @Autowired
    private OperateLogMapper operateLogMapper;


    @Override
    public PageResult<OperateLog> listOperateLog(String operateUserName, Integer page, Integer pageSize) {

        PageHelper.startPage(page, pageSize);
        List<OperateLog> operateLogList = operateLogMapper.listOperateLog(operateUserName, page, pageSize);
        Page<OperateLog> operateLog = (Page<OperateLog>) operateLogList;
        return new PageResult<>(operateLog.getTotal(), operateLog.getResult());
    }
}
